package lee.study.TestInterface;

import java.util.Arrays;

class Animal {
    protected String name;

    public Animal(String name) {
        this.name = name;
    }
}

//1.一个类可以继承一个普通类/抽象类，并且可以同时实现多个接口
// extends和implement位置不能互换
class Cat extends Animal implements IRuning {
    public Cat(String name) {
        super(name);
    }

    @Override
    public void run() {
        System.out.println(this.name + "正在用四条腿跑");
    }
}


class Fish extends Animal implements ISwimming {
    public Fish(String name) {
        super(name);
    }

    @Override
    public void swim() {
        System.out.println(this.name + "正在游泳");
    }
}

class Frog extends Animal implements ISwimming, IRuning {
    public Frog(String name) {
        super(name);
    }

    @Override
    public void run() {
        System.out.println(this.name + "正在跑");
    }

    @Override
    public void swim() {
        System.out.println(this.name + "正在游");
    }
}

interface IFlying {
    void fly();
}

interface IRuning {
    void run();
}

interface ISwimming {
    void swim();
}

public class TestMoreExtends {
    public static void main(String[] args) {
        Animal animal = new Cat("kaka");
        IRuning iRuning = new Frog("koko");
        ((Cat) animal).run();
        iRuning.run();
    }
}
